/*******************************************************************\
| PointLight.h
|
| CREATED:		12.4.2009
| DESCRIPTION:
| 
| Implements the ILight interface for point lights
\********************************************************************/
#ifndef POINTLIGHT_H
#define POINTLIGHT_H

#include "Light.h"

namespace PhotonMapping
{

//*****************************************************************************
// class overview:
//   Point light class implementation
//-----------------------------------------------------------------------------
class PointLight : public ILight
{
	public:
		PointLight(const Math::Vector3& p_Pos, const Color& p_Color, const float p_Intensity);

		// create a projection map for the given scene to optimize photon tracing
		virtual void CreateProjectionMap(const ScenePtr p_Ptr);

		// returns a light ray for photon tracing
		virtual const Math::Ray SampleLightRay(float p_U1, float p_U2);

		// returns the lights maximum emitted flux
		virtual const Color GetMaxFlux();

	private:
		// projection map resolution
		static const uintx m_PMRes = 20;

		// projection map U/V cells
		std::vector<float> m_PMCellsU;
		std::vector<float> m_PMCellsV;

		// flag whether a projection map is used or not
		bool m_UsePM;
};



}

#endif // POINTLIGHT_H
